import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/Manage.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Manage',
        component: () => import('../views/Manage.vue'),
        redirect: "/home",
        children: [
            {
                path: 'home',
                name: 'Home',
                component: () => import('../views/Home.vue'),
                meta: {breadcrumbName: '数据展示'}
            },
            {
                path: 'graph',
                name: 'Graph',
                component: () => import('../views/graph.vue'),
                meta: {breadcrumbName: '知识图谱'}
            },
            {
                path: 'user',
                name: 'User',
                component: () => import('../views/User.vue'),
                meta: {breadcrumbName: '用户管理'}
            },
            {
                path: 'article',
                name: 'Article',
                component: () => import('../views/Article.vue'),
                meta: {breadcrumbName: '文章管理'}
            },
            {
                path: 'post',
                name: 'Post',
                component: () => import('../views/Post.vue'),
                meta: {breadcrumbName: '帖子管理'}
            },
            {
                path: 'comment',
                name: 'Comment',
                component: () => import('../views/Comment.vue'),
                meta: {breadcrumbName: '评论管理'}
            },
            {
                path: 'medicine',
                name: 'Medicine',
                component: () => import('../views/Medicine.vue'),
                meta: {breadcrumbName: '药品信息管理'}
            },
            {
                path: 'order',
                name: 'Order',
                component: () => import('../views/Order.vue'),
                meta: {breadcrumbName: '订单管理'}
            }
        ]
    },
    {
        path: '/about',
        name: 'about',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('../views/Login.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
